Type ConfigurationStorageStrategyFlatFile Extends ConfigurationStorageStrategy

	Const COMMENT:String = "#"
	Const EQUALS:String  = "="

	Field fileName:String

	Method Load(cfg:TMap)
		Local fp:TStream = OpenFile(fileName)
		If Not fp Then
			Return
		End If
		Local data:String
		Local offset:Int
		Local k:String
		Local v:String
		While Not Eof(fp)
			data = ReadLine(fp).Trim()
			If Left(data, COMMENT.length) = COMMENT Then
				Continue
			End If
			offset = data.Find(EQUALS, 0)
			If offset >= 0 Then
				k = Left(data, offset).Trim()
				v = Right(data, data.length - offset - 1).Trim()
				cfg.Insert(k, v)
			End If
		Wend
		CloseFile(fp)
	End Method
	
	Method AllowSave:Int()
		Return False
	End Method
	
	Method Save(cfg:TMap)
	End Method

End Type